package com.aixingfu.sports.Adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.aixingfu.sports.Model.PersonalTrainModel;
import com.aixingfu.sports.Model.SelectCardTypeModel;
import com.aixingfu.sports.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.vondear.rxtool.RxTimeTool;

import java.util.List;

/**
 * Author : lv
 * Time : 2019.05.14 0011
 * Description :
 * 选择私教课
 */
public class PrivateEducationAdapter extends BaseQuickAdapter<PersonalTrainModel.DataBean.PrivateClassBean, BaseViewHolder> {

    private Context context;

    public PrivateEducationAdapter(int layoutResId, @Nullable List<PersonalTrainModel.DataBean.PrivateClassBean> data) {
        super(layoutResId, data);
    }

    public PrivateEducationAdapter(Context context, int layoutResId, @Nullable List<PersonalTrainModel.DataBean.PrivateClassBean> data) {
        super(layoutResId, data);

        this.context = context;
    }
    @Override
    protected void convert(BaseViewHolder helper, PersonalTrainModel.DataBean.PrivateClassBean item) {
        helper.setText(R.id.tv_product_name,item.getName())
        .setText(R.id.tv_class_name,item.getDetail().get(0).getCourse_name())
        .setText(R.id.tv_time,item.getDetail().get(0).getCourse_length()+ "分钟");
        String course_num = item.getDetail().get(0).getCourse_num();
        if (!TextUtils.isEmpty(course_num)){
            if (Integer.parseInt(course_num) == 1){
                helper.setText(R.id.tv_sing,"单课程");
            }else if (Integer.parseInt(course_num) > 1){
                helper.setText(R.id.tv_sing,"多课程");
            }
        }

    }
}
